package com.hades.xq.ares.titlebar

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity(),BaseTitleBar.OnBack {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        toolBar.getTitleBar().setCenter("测试TITLe")
        appBar.addOnOffsetChangedListener { _, verticalOffset ->
            if (Math.abs(verticalOffset) <= appBar.bottom) {
                val rate = (Math.abs(verticalOffset)).div(appBar.bottom.toFloat() - toolBar.height)
                toolBar.setUpAlpha(rate)
            } else {
                toolBar.setUpAlpha(1f)
            }
        }
        toolBar.getTitleBar().setRight(R.drawable.more_round_right, {

        })
    }

}